import { defHttp } from "@/utils/http";

// ERP 资产附属信息 VO
export interface AssetRelatedInfoVO {
	id: number; // 主键
	asmId: number; // 资产ID
	sqNumber: number; // 附属额外顺序
	sqNumb: number; // 资产顺序
	description: string; // 附属描述
	count: number; // 附属数量
	years: string; // 年月
}

// ERP 资产附属信息 API
export const AssetRelatedInfoApi = {
	// 查询资产附属信息分页
	getAssetRelatedInfoPage: async (params: any) => {
		return await defHttp.get({ url: `/whs/asm-affiliated/page`, params });
	},

	// 查询资产附属信息详情
	getAssetRelatedInfo: async (id: number) => {
		return await defHttp.get({ url: `/whs/asm-affiliated/get?id=` + id });
	},

	// 新增资产附属信息
	createAssetRelatedInfo: async (data: AssetRelatedInfoVO) => {
		return await defHttp.post({ url: `/whs/asm-affiliated/create`, data });
	},

	// 修改资产附属信息
	updateAssetRelatedInfo: async (data: AssetRelatedInfoVO) => {
		return await defHttp.put({ url: `/whs/asm-affiliated/update`, data });
	},

	// 删除资产附属信息
	deleteAssetRelatedInfo: async (id: number) => {
		return await defHttp.delete({
			url: `/whs/asm-affiliated/delete?id=` + id
		});
	},

	// 导出资产附属信息 Excel
	exportAssetRelatedInfo: async (params: any) => {
		return await defHttp.download({ url: `/whs/asm-affiliated/export-excel`, params });
	}
};
